package com.aviation.sell_ticket.mapper;

import com.aviation.sell_ticket.pojo.Aviation_login_record;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LoginRecordMapper {

    @Insert("insert into aviation_login_record values(#{loginRecord.record_id},#{loginRecord.login_time},#{loginRecord.landing_place},#{loginRecord.ip},#{loginRecord.login_method},#{loginRecord.user_id})")
    public Integer addLoginRecord(@Param("loginRecord") Aviation_login_record loginRecord);

    @Select("select login_time,landing_place,ip,login_method from aviation_login_record where user_id=#{userId} ORDER BY login_time DESC limit #{pageNumber},5")
    public List<Aviation_login_record> queryLoginInformation(@Param("userId") String userId,@Param("pageNumber") int pageNumber);
}
